# ZooKeeper runs in Java, release 1.8 or greater (JDK 8 LTS, JDK 11 LTS)
ARG J_V=jdk8:471-d132slim
FROM registry.cn-hangzhou.aliyuncs.com/xiaoyilin/${J_V}
ARG Z_V
ADD apache-zookeeper-${Z_V}-bin.tar.gz /usr/local/
RUN mv /usr/local/apache-zookeeper-${Z_V}-bin/ /usr/local/zookeeper-${Z_V} && \
cp /usr/local/zookeeper-${Z_V}/conf/zoo_sample.cfg /usr/local/zookeeper-${Z_V}/conf/zoo.cfg
ENV ZK_HOME=/usr/local/zookeeper-${Z_V}
ENV PATH=$ZK_HOME/bin:$PATH
WORKDIR /usr/local/zookeeper-${Z_V}
CMD ["zkServer.sh","start-foreground"]


# docker build --build-arg J_V=jdk8:471-d132slim --build-arg Z_V=3.8.5 -t registry.cn-hangzhou.aliyuncs.com/xiaoyilin/zookeeper:3.8.5-8 .
# docker build --build-arg J_V=java11:0.29-d132slim --build-arg Z_V=3.8.5 -t registry.cn-hangzhou.aliyuncs.com/xiaoyilin/zookeeper:3.8.5-11 .
# docker build --build-arg J_V=jdk8:471-d132slim --build-arg Z_V=3.9.4 -t registry.cn-hangzhou.aliyuncs.com/xiaoyilin/zookeeper:3.9.4-8 .
# docker build --build-arg J_V=java11:0.29-d132slim --build-arg Z_V=3.9.4 -t registry.cn-hangzhou.aliyuncs.com/xiaoyilin/zookeeper:3.9.4-11 .
# docker run --rm registry.cn-hangzhou.aliyuncs.com/xiaoyilin/zookeeper:3.8.5-8
# docker run -d -p 2181:2181 --rm registry.cn-hangzhou.aliyuncs.com/xiaoyilin/zookeeper:3.8.5-8
# docker push registry.cn-hangzhou.aliyuncs.com/xiaoyilin/zookeeper:3.8.5-8